package com.qf.springcloud.order;

import com.qf.springcloud.order.config.MyRibbonConfig;
import org.checkerframework.checker.units.qual.A;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@RibbonClient(name = "04ITEMPROVIDER-EUREKA",configuration = MyRibbonConfig.class )
@ComponentScan(excludeFilters ={@ComponentScan.Filter(A.class)})//忽略包含特定注解的类
public class OrderConsumerApplication {

    public static void main(String[] args) {
        SpringApplication.run(OrderConsumerApplication.class,args);
    }

    @Bean
    @LoadBalanced//开启负载均衡,会自动先去注册中检查我们访问的地址是不是它里面的服务,如果是会自动获取到一个地址替换过来
    public RestTemplate template(){
        return new RestTemplate();
    }
}
